﻿using MediatR;
using S.Services.SheepMale.Api.Application.Command.MarketCommand;
using S.Services.SheepMale.Domain.PurchaseSales;
using S.Services.SheepMale.Infrastructure;

namespace S.Services.SheepMale.Api.Application.CommandHandler.MarketCommandHandler
{
    public class MarkDelCommandHandler : IRequestHandler<MarketDelCommand, int>
    {
        private readonly IRepository<EntityMarket> repository;

        public MarkDelCommandHandler(IRepository<EntityMarket> repository)
        {
            this.repository = repository;
        }

        public async Task<int> Handle(MarketDelCommand request, CancellationToken cancellationToken)
        {
            return await repository.DeleteAsync(request.markId);
        }
    }
}
